package org.lzuploader.gui.listeners.main;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.lzuploader.gui.helpers.EasyMessageBox;
import org.lzuploader.model.Constants;
import org.lzuploader.model.Localization;

/**
 * Class used when the user clicks on an about widget.
 * @author Emmanuel Cron
 *
 */
public class AboutSelectionListener implements SelectionListener
{
    /** Logger of this class. */
    private static Log log = LogFactory.getLog(AboutSelectionListener.class);
    
    /** Localization of this class. */
    private static Localization localization = Localization.getInstance();
    
    
    /** Used when widget is selected by default.
     * @param e Associated event
     */
    @Override
    public void widgetDefaultSelected(final SelectionEvent e)
    {
        widgetSelected(e);
    }

    /** Used when widget is manually selected.
     * @param e Associated event
     */
    @Override
    public void widgetSelected(final SelectionEvent e)
    {
        log.debug("Displaying about dialog.");
        
        EasyMessageBox.info(
            localization.getString("DIALOG_TITLE_ABOUT"),
            "LZUploader "
            + Constants.LZ_CURRENT_RELEASE_MAJOR
            + "."
            + Constants.LZ_CURRENT_RELEASE_MINOR
            + ", pb_ee1 (c) 2008\n\n"
            + localization.getString("DIALOG_ABOUT_TEXT")
        );
    }

}
